package rabbitMqLearn.spring_boot.work;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import rabbitMqLearn.spring_boot.confg.SpringConfig;

@Component
public class WorkConsumer {

    //使用这个注解来监听队列消息
    @RabbitListener(queues = SpringConfig.WORK_QUEUE)
    void consumer(Message message) {
        System.out.println(String.format("l1 %s: %s", SpringConfig.WORK_QUEUE, message));
    }


    @RabbitListener(queues = SpringConfig.WORK_QUEUE)
    void consumer1(Message message) {
        System.out.println(String.format("l2 %s: %s", SpringConfig.WORK_QUEUE, message));
    }
}
